//
//  ViewController.m
//  24-加密
//
//  Created by 王道林 on 16/8/16.
//  Copyright © 2016年 王道林. All rights reserved.
//

#import "ViewController.h"
#import "NSString+WDLMD5.h"
#import "NSString+WDLSHA_1.h"
#import "NSString+WDLBase64.h"
#import "NSString+WDLDES.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a
    
    // MD5 SHA-1 单向散列函数. 算法(包括SHA_1)
    
    
    // MD5 验证算法. 一般用于验证密码
    NSString *string = @"wang";
    
    NSString *finel32MD5 = [string stringWith32BitMD5Lower];
    NSLog(@"%@", finel32MD5);
    
    NSString *finel16MD5 = [string stringWith16BitMD5Lower];
    NSLog(@"%@", finel16MD5);
    
    // 2 . SHA_1
    NSString *afterSHA_1 = @"HELLO";
    NSString *finalString = [afterSHA_1 stringWithSHA_1];
    NSLog(@"%@", finalString);
    
    
    // 3 . base64
    // 编码
    NSString *string64 = @"HELLO";
    NSString *base64 = [string64 stringWithBase64];
    NSLog(@"%@", base64);
    // 解码
    
    NSString *deString64 = [base64 Base64WithString];
    NSLog(@"%@", deString64);
    
    
    // 4. 对称密码
    
    // 三种算法, DES 三重DES AES
   NSString *DESstring = [string stringWithDES];
    NSLog(@"DES-------%@", DESstring);
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
